]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/thunderbolt: Connect to signals using connectObject
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 24 Jul 2025 23:08:01 +0000 (01:08 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Wed, 30 Jul 2025 20:38:19 +0000 (22:38 +0200)
To ensure that we disconnect from those signals when the Indicator goes
away, use the `connectObject()` convenience function.

This also allows removing the call to `disconnectAll()` in the AuthRobot
`close()` method.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3796>

js/ui/status/thunderbolt.js

index f0ee7edf1e834c4b6ed3c5b290a9af9fdabcdae4..6c14003517974006ab06bece913813f412294c09 100644 (file)
@@ -139,7 +139,6 @@ class AuthRobot extends Signals.EventEmitter {
     }
 
     close() {
-        this.disconnectAll();
         this._client = null;
     }
 
@@ -224,12 +223,14 @@ class Indicator extends SystemIndicator {
         this._indicator.icon_name = 'thunderbolt-symbolic';
 
         this._client = new Client();
-        this._client.connect('probing-changed', this._onProbing.bind(this));
+        this._client.connectObject(
+            'probing-changed', this._onProbing.bind(this), this);
 
         this._robot =  new AuthRobot(this._client);
-
-        this._robot.connect('enroll-device', this._onEnrollDevice.bind(this));
-        this._robot.connect('enroll-failed', this._onEnrollFailed.bind(this));
+        this._robot.connectObject(
+            'enroll-device', this._onEnrollDevice.bind(this),
+            'enroll-failed', this._onEnrollFailed.bind(this),
+            this);
 
         this.connect('destroy', () => this._onDestroy());